let http = require('http')
let cp = require('child_process') // 子进程
let proess = require('process')

let port = 8000;

// 启动服务
let app = http.createServer((req, res) => {
    // request 请求   response 响应
    res.writeHead(200, {'Content-Type': 'application/josn'}); // 响应头
    res.end(' 111111');
}).listen(port)
console.log(`服务已经成功启动，地址：http://localhost:${port}/`);
cp.exec(`open http://localhost:${port}/`) // start
console.log(proess.platform);  // platform 平台

if(proess.platform === 'win32'){
    cp.exec(`start http://localhost:${port}/`)
}else{
    cp.exec(`open http://localhost:${port}/`)
}

